home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 04 - 1988 / 04.09 Sep 88 / 4d stuff / Source Files / PlayPict.p < prev    next >
Encoding:
Text File  |  1988-06-22  |  1.0 KB  |  53 lines  |  [TEXT/MPS ]

  1. Program Ext_PlayPict;
  2.  
  3. Uses MemTypes, QuickDraw, OSIntf,
  4.         ToolIntf, PackIntf, Sound;
  5.  
  6. Var
  7.     DPict:PicHandle;
  8.     DFile, DSound:integer;
  9.  
  10. procedure PlayPict(
  11.     var Numer, Denom:integer;
  12.     var MyPict:PicHandle);
  13.  
  14. type
  15.     FFSynthHandle=^FFSynthPtr;
  16.  
  17. var
  18.     MySound:FFSynthHandle;
  19.     MyPtr:Ptr;
  20.     MyFFPtr:FFSynthPtr;
  21.  
  22. begin
  23.     {make sure that we recieved something}
  24.     if MyPict<>Nil then
  25.     begin
  26.         {Coerce the handle}
  27.         MySound:=FFSynthHandle(MyPict);
  28.         {Lock the sound so we don't lose it}
  29.         HLock(Handle(MySound));
  30.         {Copy the pointer}
  31.         MyPtr:=Ptr(MySound^);
  32.         {Type Coerce the pointer}
  33.         MyFFPtr:=FFSynthPtr(MyPtr);
  34.         {Set the playback mode}
  35.         MyFFPtr^.mode:=FFMode;
  36.         {Set the playback count to the}
  37.         {parameters passed.}
  38.         MyFFPtr^.count:=FixRatio(Numer, Denom);
  39.         MyFFPtr^.wavebytes[0]:=0;
  40.         {Play the sound}
  41.         StartSound(MyPtr,
  42.             GetHandleSize(Handle(MySound)),
  43.             POINTER(-1));
  44.         {Unlock the sound so it can be}
  45.         {disposed}
  46.         HUnLock(Handle(MySound));
  47.     end;        {if MyPict<>Nil}
  48. end;        {PlayPict}
  49.  
  50. Begin
  51.     PlayPict(DFile, DSound, DPict);
  52. End.        {Main Block}
  53.